package controller;


public class Course {
	String name;
	String description;
	Float pointNum;
	Integer capacity;
	Integer groupNum;
	String creator;
	CourseSession[] sessions;
	
	public Course(String name,String decription,Float pointNum
			     ,Integer capacity,Integer groupNum,String creator
			     ,CourseSession[] sessions)
	{
		this.name=name;
		this.description=decription;
		this.pointNum=pointNum;
		this.capacity=capacity;
		this.groupNum=groupNum;
		this.creator=creator;
		this.sessions=sessions;
	}
	
	public boolean addCollideWith(Course course) {
		if(course.getGroupNum() != groupNum)
		{
			return false;
		}
		return this.collideWith(course);
	}
	
	public boolean collideWith(Course course)
	{
		CourseSession[] otherSessions=course.getSessions();
		for(int i=0;i<sessions.length;i++)
		{
			for(int j=0;j<otherSessions.length;j++)
			{
				if(sessions[i].collideWith(otherSessions[j]))
				{
					return true;
				}
			}
		}
		return false;
	}

	public CourseSession[] getSessions() {
		return sessions;
	}

	public String getName() {
		return name;
	}

	public String getDescription() {
		return description;
	}

	public Float getPointNum() {
		return pointNum;
	}

	public Integer getCapacity() {
		return capacity;
	}

	public Integer getGroupNum() {
		return groupNum;
	}

	public String getCreator() {
		return creator;
	}


	

	
}
